package com.nasarius.bank.scorecard.web.controller.admin;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.propertyeditors.CustomCollectionEditor;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.ServletRequestDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.nasarius.bank.scorecard.dao.UploadLogDAO;
import com.nasarius.bank.vo.UploadLogVO;
@Controller
public class UploadLogController {
	 /** Logger that is available to subclasses */
	 protected final Log LOG = LogFactory.getLog(getClass());
		@Autowired
		private UploadLogDAO uploadLogDAO;
		@InitBinder
		protected void initBinder(ServletRequestDataBinder binder) {
				binder.registerCustomEditor(List.class,new CustomCollectionEditor(List.class));
		}		
		/**
		 * For every request for this controller, this will create a UploadLogDetails
		 * instance for the form .
		 */
		@ModelAttribute
		public UploadLogVO newRequest(Model model) {
			UploadLogVO uploadLogVO = new UploadLogVO();
			uploadLogVO.setUploadLog(uploadLogDAO.selectAllUploadLogs());
			return uploadLogVO;
		}
		   /**
	     * <p>Person form request.</p>
	     * 
	     * <p>Expected HTTP GET and request '/uploadlog/view'.</p>
	     */
	    @RequestMapping(value="/uploadlog/view", method=RequestMethod.GET)
	    public void form() {}
	    
	    public void setUploadLogDAO(UploadLogDAO uploadLogDAO) {
			this.uploadLogDAO = uploadLogDAO;
		}
}
